import Vue from 'vue'
import App from './App.vue'
// import VueRouter from 'vue-router'  //路由分离转至router.js
// Vue.use(VueRouter)
import VueResource from 'vue-resource'
Vue.use(VueResource)

// 路由分离后引入路由文件
import router from './router/router.js'

// //1. 创建组件                          //路由分离转至router.js
// import Home from './components/Home.vue';
// import News from './components/News.vue';
// import User from './components/User.vue';
//   import UserAdd from './components/User/UserAdd.vue';
//   import UserList from './components/User/UserList.vue';
// import NewsDetail from './components/NewsDetail.vue';
// import ProductDetail from './components/ProductDetail.vue';
// //2. 配置路由
// const routes = [
//   { path: '/home', component: Home },
//   { path: '/news', component: News, name:'newsName' },/*命名路由*/
//   { 
//     path: '/user', 
//     component: User, 
//     // 配置嵌套路由
//     children:[
//       {path:'userAdd', component:UserAdd},
//       {path:'userList', component:UserList}
//     ]
//   },
//   { path: '/newsDetail/:aid', component: NewsDetail }, /*配置动态路由*/
//   { path: '/productDetail', component: ProductDetail },
//   { path: '*', redirect: '/home'}  /*默认跳转路由 */
// ]
// //3. 实例化VueRouter
// const router = new VueRouter({
//   mode:'history',  /*编程式路由默认的hash模式改为history模式. hash模式在路径中带#号,history模式不带#,但是需在web服务器里配置*/
//   routes // (缩写) 相当于 routes: routes
// })

//4. 挂载路由
new Vue({
  el: '#app',
  router,
  render: h => h(App)
})
